Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Silicon Vendors
  • Support
  • About Us
  • Blog
  • Forum
  • Search
  • Jobs
  • Newsletter
  • Blog
  • Contact
  • Shop
  • emCompress
  • emCompress-PRO

    emCompress-PRO
    The allround compression solution

    emCompress-PRO provides compression and decompression in any host application or embedded firmware, perfectly fitting most common use cases.

    Contact us
    Downloads
    Documentation
    SEGGER emCompress
    1. 1.Key features
    2. 2.Codecs & performance values
      1. 2.1.DEFLATE
      2. 2.2.LZMA
      3. 2.3.LZJU90
      4. 2.4.LZPJ
    3. 3.API use
      1. 3.1.Code example
    4. 4.Use cases
      1. 4.1.Speed up firmware updates
      2. 4.2.Minimize the required memory footprint for asset storage
      3. 4.3.Process data provided by third-party compression tools
      4. 4.4.Compress data on different kinds of targets
    5. 5.Media gallery

    Overview

    emCompress-PRO is a versatile compression library for most common use cases. It provides standard compression codecs and a zlib-like API for compression and decompression of input streams.

    emCompress-PRO includes all compression and decompression codecs in source code, which enables usage in any host application and in any embe­dded firmware. In addition to the codecs, emCompress-PRO includes example application code for archive handling.

    Key features

    • Compression and decompression of streams and files

    • Common codecs included: DEFLATE, LZMA, LZPJ, LZJU90

    • Easy-to-use zlib-like API

    • Source code for host and embedded applications

    Codecs & performance values

    emCompress-PRO includes well-defined, commonly used compression codecs. All codecs are implemented according to their specification or RFC, which enables interoperability with other tools and libraries.

    DEFLATE

    DEFLATE is the lossless compression stream format originally developed for and with the ZIP file format. It uses a combination of LZ77 and Huffman coding. DEFLATE is specified in RFC 1951.

    CodecCompressed size [1]Compression speed [2]Decompression speed [2]Compression RAMDecompression RAM
    DEFLATE(128,3,258)133.531 KB23611140.934 KB12.672 KB
    DEFLATE(256,3,258)128.562 KB26110741.559 KB12.855 KB
    DEFLATE(512,3,258)121.521 KB29610042.809 KB13.184 KB
    DEFLATE(1k,3,258)116.601 KB3759645.309 KB13.738 KB
    DEFLATE(2k,3,258)114.010 KB5049450.309 KB14.785 KB
    DEFLATE(4k,3,258)112.430 KB7429260.309 KB16.832 KB
    DEFLATE(8k,3,258)111.637 KB1,0789180.309 KB20.879 KB
    DEFLATE(12k,3,258)111.396 KB1,76892100.309 KB24.902 KB
    DEFLATE(16k,3,258)111.310 KB1,45991120.309 KB28.926 KB
    DEFLATE(32k,3,258)111.313 KB1,01190200.309 KB44.969 KB

    LZMA

    LZMA (Lempel–Ziv–Markov chain algorithm) is the lossless compression algorithm which was first used in the 7z file format. This algorithm uses a dictionary compression scheme similar to the LZ77 algorithm and features a high compression ratio and a variable compression-dictionary size, while still maintaining decompression speed similar to other commonly used compression algorithms.

    CodecCompressed size [1]Compression speed [2]Decompression speed [2]Compression RAMDecompression RAM
    LZMA(1k,0,0,0)108.676 KB282876.010 MB5,060 B
    LZMA(1k,3,1,1)103.675 KB289916.010 MB27.613 KB
    LZMA(2k,0,0,0)106.270 KB363916.015 MB6,084 B
    LZMA(2k,3,1,1)101.701 KB378936.015 MB28.613 KB
    LZMA(4k,0,0,0)104.640 KB582856.025 MB8,132 B
    LZMA(4k,3,1,1)100.450 KB593906.025 MB30.613 KB
    LZMA(8k,0,0,0)103.592 KB980876.044 MB11.941 KB
    LZMA(8k,3,1,1)99.742 KB992876.044 MB34.613 KB
    LZMA(16k,0,0,0)102.706 KB1,821826.083 MB19.941 KB
    LZMA(16k,3,1,1)99.198 KB1,785856.083 MB42.613 KB
    LZMA(32k,0,0,0)102.059 KB2,389976.162 MB35.941 KB
    LZMA(32k,3,1,1)98.808 KB2,550866.162 MB58.613 KB
    LZMA(64k,0,0,0)100.030 KB4,182896.318 MB67.941 KB
    LZMA(64k,3,1,1)97.180 KB4,274836.318 MB90.613 KB
    LZMA(128k,0,0,0)99.840 KB5,081856.630 MB131.941 KB
    LZMA(128k,3,1,1)97.067 KB5,026866.630 MB154.613 KB
    LZMA(256k,0,0,0)99.851 KB3,001837.255 MB259.941 KB
    LZMA(256k,3,1,1)97.080 KB3,212877.255 MB282.613 KB

    LZJU90

    LZJU90 defines the transfer encoding for MIME compliant mail systems. It uses prefix coding of a length and distance that leaves literals uncompressed.

    CodecCompressed size [1]Compression speed [2]Decompression speed [2]Compression RAMDecompression RAM
    LZJU(1535,2,255,9,1,10)121.459 KB363569.898 KB1,616 B
    LZJU(1535,3,256,9,1,10)127.421 KB291489.906 KB1,616 B
    LZJU(3583,2,255,9,1,11)117.644 KB6845419.898 KB3,664 B
    LZJU(3583,3,256,9,1,11)122.245 KB5394819.906 KB3,664 B
    LZJU(7679,2,255,9,1,12)116.253 KB1,1395439.898 KB7,760 B
    LZJU(7679,3,256,9,1,12)119.478 KB8784939.906 KB7,760 B
    LZJU(10751,2,255,9,2,13)117.183 KB1,5685354.898 KB10.578 KB
    LZJU(10751,3,256,9,2,13)119.294 KB1,2565054.906 KB10.578 KB
    LZJU(15871,2,255,9,1,13)115.639 KB2,5215579.898 KB15.578 KB
    LZJU(15871,3,256,9,1,13)117.665 KB1,6355079.906 KB15.578 KB
    LZJU(32255,2,255,9,1,14)115.902 KB4,30855159.898 KB31.578 KB
    LZJU(32255,3,256,9,1,14)116.756 KB2,48552159.906 KB31.578 KB
    LZJU(43519,3,256,9,2,15)117.021 KB3,94449214.906 KB42.578 KB
    LZJU(43519,2,255,9,2,15)116.456 KB5,33755214.898 KB42.578 KB
    LZJU(65023,2,255,9,1,15)115.133 KB6,73658319.898 KB63.578 KB
    LZJU(65023,3,256,9,1,15)114.745 KB5,34552319.906 KB63.578 KB

    LZPJ

    LZPJ is the "plain jane" implementation of LZ77.

    CodecCompressed size [1]Compression speed [2]Decompression speed [2]Compression RAMDecompression RAM
    LZPJ(127,3,18)159.831 KB230391,904 B184 B
    LZPJ(255,3,18)151.369 KB302442,544 B312 B

    [1]  Uncompressed input size: 182.695 KB

    [2]  ns/Byte on Intel i7 @ 4.6GHz, only for comparison between codecs

    API use

    emCompress-PRO provides a simple zlib-like API, for incremental process of input. This interface enables the use of compression and decompression of data on the fly. It can be used to process data in chunks as they are received from a remote system instead of requiring that all data be available at once. It can also be used to process data and output chunks into a small buffer for further processing instead of requiring a large output buffer that can hold all of the  compressed or decompressed data at once. Chunk-wise input and output can be combined to ensure minimum memory buffer requirements.

    Code example

    /*********************************************************************
    *
    *       Decompress()
    *
    *  Function description
    *    Decompress DEFLATE or LZMA blocks.
    *
    *  Parameters
    *    pFile  - Pointer to input file.
    *    pAPI   - Pointer to decompression API.
    *    pParas - Pointer to decompression parameters.
    *    Size   - Size of data to decompress.
    */
    void Decompress(FILE* pFile, const CX_DECODE_API* pAPI, const CX_PARAS* pParas, int Size) {
      CX_DECODE_CONTEXT C;
      CX_STREAM         Stream;
      int               Status;
      U8                ByteIn;
      U8                ByteOut;
      //
      // Prepare decoder and stream.
      //
      Stream.AvailIn  = 0;
      Stream.AvailOut = 0;
      Status = CX_DECODE_Init(&C, pAPI, &_StaticAllocator, pParas);
      //
      for (;;) {
        //
        // Read next byte from input.
        //
        if (Stream.AvailIn == 0 && Size > 0) {
          fread(&ByteIn, 1, 1, pFile);
          Stream.pIn     = &ByteIn;
          Stream.AvailIn = 1;
          Size--;
        }
        //
        // Reset output buffer.
        //
        Stream.pOut     = &ByteOut;
        Stream.AvailOut = 1;
        //
        // Process stream.
        //
        Status = CX_DECODE_Process(&C, &Stream, Size == 0 ? CX_FLUSH_END : CX_FLUSH_NONE);
        if (Status < 0) {
          printf("Failed to decode: %s\n", CX_GetErrorText(Status));
          exit(100);
        }
        if (Status == 1) {
          break;
        }
      }
      //
      CX_DECODE_Exit(&C);
    }

    Use cases

    emCompress-PRO is the allround solution for compression and decompression.

    Speed up firmware updates

    Modern products, in particular IoT devices, require the ability to update their firmware in the field. Most of these devices implement over-the-air (OTA) updates through their main communication channel. When a device is connected via WiFi, available bandwidth is not an issue, but other channels such as Bluetooth or Zigbee might have limited bandwidth. Also, updates via wired connections often have bandwidth restrictions, e.g. the popular CAN bus.

    To speed up the update process, lossless compression of firmware images reduces the amount of data to be transferred to the device. emCompress-PRO enables firmware updates with compressed images. Its interface is suited to receive a compressed data stream and to decompress it on the fly for the update module, which processes the decompressed data afterward.

    Learn more at:
    https://casestudies.segger.com/size-matters-using-emcompress-to-accelerate-firmware-updates-via-can-bus/

    Use case graphic SEGGER emCompress-PRO — Speed up firmware updates

    Minimize the required memory footprint for asset storage

    Most systems include digital assets for their user interface. Assets can be images, videos and fonts for a graphical user interface (GUI) on a display, sound files to be output on a speaker, web pages for a web or app interface, or any other static data. Storage space for static data, such as an external flash, can be limited. To fit more data into available memory, or even to design hardware with smaller memory, digital assets can be stored in compressed form.

    emCompress-PRO enables on-demand decompression of data when it is needed. Data can be decompressed into small chunks so the entire asset doesn’t have to be held in memory before being deployed.

    Process data provided by third-party compression tools

    Connected devices might receive compressed data from external sources. When a device does not include its own software to manage such data, the system might need to be designed to process data created by third-party tools.

    emCompress-PRO implements popular codecs, such as DEFLATE and LZMA, which provides compatibility with commonly used compression tools. A system receiving external data can select the decompressor on demand making it ready for most customer use cases.

    Data is not always compressed  in a single block but may be packaged in an archive. While emCompress-PRO implements compression codecs, it also comes with sample code to handle and process common archive formats. An input archive stream can be decompressed into structured files when a file system like emFile is used.

    Compress data on different kinds of targets

    Most use cases require decompression on the target system. Compression of data can be done with off-the-shelf tools, such as the popular zip file archiver, or integrated in a tool or framework which also creates the data, such as a firmware update utility.

    Besides data decompression emCompress-PRO provides compression functionality as well and is not limited to embedded targets. Both parts of the codecs are written in plain C and can be integrated in firmware images as well as host applications.

    Media gallery

    Video thumbnail SEGGER emCompress — Example application project

    emCompress — Example application | 2:43 min

    Video thumbnail SEGGER emCompress-ToGo — Compress your data in real-time on any embedded system

    emCompress-ToGo — Intro | 5:36 min

      View more...


    Related news

    2021
    Aug.16
    emCompress
    SEGGER News: eSOL licences SEGGER emCompress for accelerating automotive firmware updates

    eSOL licences SEGGER emCompress for accelerating automotive firmware updates

    Leading Japanese embedded engineering supplier eSOL has licensed SEGGER's emCompress compression software to enable faster firmware updates in Electronic Control Units (ECUs) for automotive customers.

    [Read more...]

    All news

    • List of downloads
    • Update notification
    • Pricing
    • Support
    • Silicon vendor resources
    • Videos

    Headquarters

    SEGGER Microcontroller GmbH

    Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    info@segger.com
    Tel.: +49-2173-99312-0
    Fax: +49-2173-99312-28

    Locations

    USA: SEGGER Microcontroller Systems LLC

    Boston area
    101 Suffolk Lane
    Gardner, MA 01440, USA
    us-east@segger.com
    Tel.: +1-978-874-0299
    Fax: +1-978-874-0599

    Silicon Valley
    Milpitas, CA 95035, USA
    us-west@segger.com
    Tel.: +1-408-767-4068

    China: SEGGER Microcontroller China Co., Ltd.

    Room 218, Block A, Dahongqiaoguoji
    No. 133 Xiulian Road
    Minhang District, Shanghai 201199, China
    china@segger.com
    Tel.: +86-133-619-907-60

    ISO 9001 certified

    ISO 9001

    30+ years of experience

    First-class embedded software tools since 1992
    • Imprint
    • Disclaimer
    • Code of Conduct
    • Privacy Policy
    © 2025 SEGGER - All rights reserved.